﻿using System.Collections.Generic;

namespace BuzzX8.Xmpp.StreamElements.Factories
{
    public abstract class StreamElementFactory
    {
        private PropertyDictionary defaultParameters;

        protected StreamElementFactory()
        {
            defaultParameters = new PropertyDictionary();
        }

        public PropertyDictionary DefaultParameters
        {
            get { return defaultParameters; }
        }

        public StreamElement CreateElement(IDictionary<string, object> parameters = null)
        {
            if (parameters == null) return CreateElement(DefaultParameters);
            PropertyDictionary elementParameters = new PropertyDictionary(DefaultParameters);
            elementParameters.Merge(parameters);
            return CreateElement(elementParameters);
        }

        protected abstract StreamElement CreateElement(PropertyDictionary parameters);
    }
}
